package com.pethospital.entity;

import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * 宠物实体类
 * Pet Entity Class
 * 
 * @author PetHospital System
 * @version 1.0
 */
public class Pet {
    
    private Integer petId;           // 宠物ID
    private String petName;          // 宠物姓名
    private String petType;          // 宠物类型（狗、猫等）
    private String breed;            // 品种
    private String gender;           // 性别：male-雄性，female-雌性
    private Integer age;             // 年龄（月）
    private BigDecimal weight;       // 体重（kg）
    private String color;            // 毛色
    private Integer ownerId;         // 主人ID
    private String description;      // 描述信息
    private String photoUrl;         // 照片路径
    private String status;           // 健康状态：healthy-健康，sick-生病，treatment-治疗中
    private Timestamp createTime;    // 创建时间
    private Timestamp updateTime;    // 更新时间
    
    // 关联对象
    private User owner;              // 主人信息

    /**
     * 默认构造函数
     */
    public Pet() {
    }

    /**
     * 带参构造函数
     */
    public Pet(String petName, String petType, String breed, String gender, Integer age, 
               BigDecimal weight, String color, Integer ownerId, String description) {
        this.petName = petName;
        this.petType = petType;
        this.breed = breed;
        this.gender = gender;
        this.age = age;
        this.weight = weight;
        this.color = color;
        this.ownerId = ownerId;
        this.description = description;
        this.status = "healthy";
    }

    // Getter和Setter方法
    public Integer getPetId() {
        return petId;
    }

    public void setPetId(Integer petId) {
        this.petId = petId;
    }

    public String getPetName() {
        return petName;
    }

    public void setPetName(String petName) {
        this.petName = petName;
    }

    public String getPetType() {
        return petType;
    }

    public void setPetType(String petType) {
        this.petType = petType;
    }

    public String getBreed() {
        return breed;
    }

    public void setBreed(String breed) {
        this.breed = breed;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Integer getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(Integer ownerId) {
        this.ownerId = ownerId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getPhotoUrl() {
        return photoUrl;
    }

    public void setPhotoUrl(String photoUrl) {
        this.photoUrl = photoUrl;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    public User getOwner() {
        return owner;
    }

    public void setOwner(User owner) {
        this.owner = owner;
    }

    /**
     * 获取年龄显示文本（年+月）
     */
    public String getAgeDisplay() {
        if (age == null) return "未知";
        int years = age / 12;
        int months = age % 12;
        if (years > 0) {
            return years + "岁" + (months > 0 ? months + "个月" : "");
        } else {
            return months + "个月";
        }
    }

    /**
     * 获取性别显示文本
     */
    public String getGenderDisplay() {
        if ("male".equals(gender)) {
            return "雄性";
        } else if ("female".equals(gender)) {
            return "雌性";
        }
        return "未知";
    }

    /**
     * 获取状态显示文本
     */
    public String getStatusDisplay() {
        switch (status) {
            case "healthy": return "健康";
            case "sick": return "生病";
            case "treatment": return "治疗中";
            default: return "未知";
        }
    }

    @Override
    public String toString() {
        return "Pet{" +
                "petId=" + petId +
                ", petName='" + petName + '\'' +
                ", petType='" + petType + '\'' +
                ", breed='" + breed + '\'' +
                ", gender='" + gender + '\'' +
                ", age=" + age +
                ", weight=" + weight +
                ", ownerId=" + ownerId +
                ", status='" + status + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
